package com.geek;

import javax.ws.rs.Path;
import java.lang.reflect.AnnotatedElement;


public interface PathUtils {

    String SLASH = "/";

    static  String resolvePath(AnnotatedElement annotatedElement) {
        Path declaredAnnotation = annotatedElement.getDeclaredAnnotation(Path.class);
        if (declaredAnnotation == null) {
            return null;
        }
        String value = declaredAnnotation.value();
        if (!value.startsWith(SLASH)) {
            value = SLASH + value;
        }
        return value;
    }
}
